libostree: Get and set OstreeAsyncProgress:status atomically
authorPhilip Withnall <withnall@endlessm.com>
Fri, 28 Apr 2017 18:32:17 +0000 (19:32 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Sat, 29 Apr 2017 11:50:15 +0000 (11:50 +0000)
Use the new well-known `status` key for OstreeAsyncProgress to get and
set the status atomically with other keys in an OstreeAsyncProgress
instance.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #819
Approved by: cgwalters

src/libostree/ostree-repo-pull.c
src/libostree/ostree-repo.c

index f7dbd79e790ad1a414feadda38fe2f97608f4f7f..c6b636692ec9e51670bbb1815600658f0f603428 100644 (file)
@@ -240,10 +240,10 @@ update_progress (gpointer user_data)
                              /* We fetch metadata before content.  These allow us to report metadata fetch progress specifically. */
                              "outstanding-metadata-fetches", "u", pull_data->n_outstanding_metadata_fetches,
                              "metadata-fetched", "u", pull_data->n_fetched_metadata,
+                             /* Overall status. */
+                             "status", "s", "",
                              NULL);
 
-  ostree_async_progress_set_status (pull_data->progress, NULL);
-
   if (pull_data->dry_run)
     pull_data->dry_run_emitted_progress = TRUE;
 
index 8e2b1c21d37d95323f90ea21eb386c0c280445d7..1bb4d3c34ba380cb7ff18f1cee2ed785db6d50c4 100644 (file)
@@ -3748,8 +3748,6 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
 
   buf = g_string_new ("");
 
-  status = ostree_async_progress_get_status (progress);
-
   ostree_async_progress_get (progress,
                              "outstanding-fetches", "u", &outstanding_fetches,
                              "outstanding-metadata-fetches", "u", &outstanding_metadata_fetches,
@@ -3760,9 +3758,10 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
                              "total-delta-parts", "u", &total_delta_parts,
                              "fetched-delta-fallbacks", "u", &fetched_delta_part_fallbacks,
                              "total-delta-fallbacks", "u", &total_delta_part_fallbacks,
+                             "status", "s", &status,
                              NULL);
 
-  if (status)
+  if (*status != '\0')
     {
       g_string_append (buf, status);
     }